package com.ucode.cgms.service.impl;

import com.ucode.cgms.mapper.CgmsCompanionCategoryMapper;
import com.ucode.cgms.service.CgmsCompanionCategoryService;
import com.ucode.model.cgms.CgmsCompanionCategory;
import com.ucode.tool.base.enums.CommonSwitchStatusEnum;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.*;

@Service
public class CgmsCompanionCategoryServiceImpl implements CgmsCompanionCategoryService {

    @Resource
    private CgmsCompanionCategoryMapper companionCategoryMapper;

    @Override
    public CgmsCompanionCategoryMapper initMapper() {
        return companionCategoryMapper;
    }

    @Override
    public int updateStatus(Collection<Long> ids, Integer status) {
        return companionCategoryMapper.updateStatus(ids, status);
    }

    @Override
    public List<CgmsCompanionCategory> queryListByEnable() {
        Map<String,Object> condition = new HashMap<>();
        condition.put("status", CommonSwitchStatusEnum.ENABLE.getCode());
        condition.put("deltag",false);
        return this.queryObjectForList(condition,0);
    }

    @Override
    public List<CgmsCompanionCategory> queryListByEnable(Long zoneId) {
        Map<String,Object> condition = new HashMap<>();
        condition.put("status", CommonSwitchStatusEnum.ENABLE.getCode());
        condition.put("zoneId",zoneId);
        condition.put("deltag",false);
        return this.queryObjectForList(condition,0);
    }
}
